﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                    mc:Ignorable="d">
    
    <!--Metro Header TabControl-->
    <Style x:Key="MetroHeaderTabControl" TargetType="{x:Type TabControl}">
        <Setter Property="FontFamily" Value="{DynamicResource MetroFontSemiBold}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid KeyboardNavigation.TabNavigation="Local">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>

                        <!-- TabPanel is a layout container which allows the TabItems to wrap and re-order when selected
						The implementation knows to use this control because it is marked IsItemsHost = True -->
                        <TabPanel Grid.Row="1" Height="36" Margin="5,0,0,0" x:Name="HeaderPanel" Background="Transparent" Panel.ZIndex="1" KeyboardNavigation.TabIndex="1" d:LayoutOverrides="GridBox" VerticalAlignment="Top"/>
                        <!-- The implementation switches the content. This control must be named PART_SelectedContentHost -->
                        <ContentPresenter Margin="0,24,0,0" x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Grid.Row="1"/>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="Gray"/>
                        </Trigger>
                    </ControlTemplate.Triggers>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="MetroHeaderTabItem" TargetType="{x:Type TabItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid Margin="0,0,12,0" HorizontalAlignment="Left">
                        <ContentPresenter HorizontalAlignment="Stretch" Margin="0" x:Name="ContentSite" VerticalAlignment="Stretch" RecognizesAccessKey="True" ContentSource="Header">
                            <ContentPresenter.Style>
                                <Style>
                                    <Setter Property="TextElement.FontFamily" Value="{DynamicResource MetroFontRegular}"/>
                                    <Setter Property="TextElement.FontSize" Value="12"/>
                                </Style>
                            </ContentPresenter.Style>
                        </ContentPresenter>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Panel.ZIndex" Value="100"/>
                            <Setter Property="TextElement.Foreground" Value="White" TargetName="ContentSite"/>
                        </Trigger>
                        <Trigger Property="IsSelected" Value="False">
                            <Setter Property="TextElement.Foreground" Value="#989898" TargetName="ContentSite"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="False"/>
                                <Condition Property="IsMouseOver" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="TextElement.Foreground" Value="{DynamicResource LibertyAccentBrushSecondary}" TargetName="ContentSite"/>
                        </MultiTrigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="Gray"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="MetroHeaderTabItemSub" d:IsControlPart="True" TargetType="{x:Type TabItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid Margin="0,0,12,0" HorizontalAlignment="Left">
                        <ContentPresenter HorizontalAlignment="Stretch" Margin="0" x:Name="ContentSite" VerticalAlignment="Stretch" RecognizesAccessKey="True" ContentSource="Header">
                            <ContentPresenter.Style>
                                <Style>
                                    <Setter Property="TextElement.FontFamily" Value="{DynamicResource MetroFontSemiLight}"/>
                                    <Setter Property="TextElement.FontSize" Value="17"/>
                                </Style>
                            </ContentPresenter.Style>
                        </ContentPresenter>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Panel.ZIndex" Value="100"/>
                            <Setter Property="TextElement.Foreground" Value="White" TargetName="ContentSite"/>
                        </Trigger>
                        <Trigger Property="IsSelected" Value="False">
                            <Setter Property="TextElement.Foreground" Value="#989898" TargetName="ContentSite"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="False"/>
                                <Condition Property="IsMouseOver" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="TextElement.Foreground" Value="{DynamicResource LibertyAccentBrushSecondary}" TargetName="ContentSite"/>
                        </MultiTrigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="Gray"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>